import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, IsBoolean, IsEnum, IsNumber } from 'class-validator';
import { PaginationDto } from '../../common/dto/pagination.dto';

export class QueryMenuDto extends PaginationDto {
  @ApiProperty({
    description: '菜单名称（模糊搜索）',
    example: '用户管理',
    required: false
  })
  @IsOptional()
  @IsString()
  name?: string;

  @ApiProperty({
    description: '菜单路径（模糊搜索）',
    example: '/system',
    required: false
  })
  @IsOptional()
  @IsString()
  path?: string;

  @ApiProperty({
    description: '菜单类型',
    example: 'menu',
    enum: ['menu', 'button'],
    required: false
  })
  @IsOptional()
  @IsEnum(['menu', 'button'])
  type?: 'menu' | 'button';

  @ApiProperty({
    description: '父菜单ID',
    example: 0,
    required: false
  })
  @IsOptional()
  @IsNumber()
  parent_id?: number;

  @ApiProperty({
    description: '菜单层级',
    example: 1,
    required: false
  })
  @IsOptional()
  @IsNumber()
  level?: number;

  @ApiProperty({
    description: '是否可见',
    example: true,
    required: false
  })
  @IsOptional()
  @IsBoolean()
  is_visible?: boolean;

  @ApiProperty({
    description: '是否启用',
    example: true,
    required: false
  })
  @IsOptional()
  @IsBoolean()
  is_enabled?: boolean;

  @ApiProperty({
    description: '权限标识（模糊搜索）',
    example: 'system:user',
    required: false
  })
  @IsOptional()
  @IsString()
  permission?: string;
}
